package com.ctshk.app.bus.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.bus.req.BusQueryReq;
import com.ctshk.rpc.bus.service.IBusProductAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@Api(tags = "巴士服务—APP&H5")
@RestController
@RequestMapping("/bus/order/h5")
public class BusProductH5Controller extends BaseController {

	@DubboReference
	IBusProductAppService busOrderAppServiceImpl;

	@ApiOperation(value="巴士-首页-路线-查询", notes="巴士-首页-路线-查询")
	@OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "巴士-首页-路线-查询", operDesc = "巴士-首页-路线-查询")
	@PostMapping("/line/query")
	public Result lineQuery(@RequestBody @Valid BusQueryReq req) {
		return busOrderAppServiceImpl.lineQuery(req);
	}

	@ApiOperation(value="巴士-首页-到达城市-查询", notes="巴士-首页-到达城市-查询")
	@OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "巴士-首页-到达城市-查询", operDesc = "巴士-首页-到达城市-查询")
	@PostMapping("/arriveCity/query")
	public Result arriveCityQuery(@RequestBody @Valid BusQueryReq req) {
		return busOrderAppServiceImpl.arriveCityQuery(req);
	}

	@ApiOperation(value="巴士订单-首页-热门路线-查询", notes="巴士订单-首页-热门路线-查询")
	@OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.QUERY, operTitle = "巴士订单-首页-热门路线-查询", operDesc = "巴士订单-首页-热门路线-查询")
	@GetMapping("/hotline/query/{cityName}")
	public Result hotLineQuery(@PathVariable("cityName") String cityName) {
		return busOrderAppServiceImpl.hotLineQuery(cityName);
	}

}
